package com.lj.message.result;

import com.lj.message.entity.SysMessage;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统消息表 信息结果
 * </p>
 *
 * @author luojing
 * @since 2025-10-15 16:57:29
 */
@Data
@Schema(description = "系统消息表 信息结果")
public class SysMessageInfoResult {

    @Schema(description = "主键id ")
    private Long id;

    @Schema(description = "消息标题 ")
    private String title;

    @Schema(description = "消息内容 ")
    private String content;

    @Schema(description = "是否已读 ")
    private Boolean read;

    @Schema(description = "创建时间 ")
    private LocalDateTime createTime;

    public static SysMessageInfoResult of(SysMessage entity) {
        if (entity == null) {
            return null;
        }
        SysMessageInfoResult result = new SysMessageInfoResult();
        result.setId(entity.getId());
        result.setTitle(entity.getTitle());
        result.setContent(entity.getContent());
        result.setRead(entity.getMarkRead());
        result.setCreateTime(entity.getCreateTime());
        return result;
    }
}
